package com.eternal.permission.controller;


import com.eternal.Exception.ResultVo;
import com.eternal.permission.entity.RoleInfo;
import com.eternal.permission.service.UserRoleService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 用户角色表 前端控制器
 * </p>
 *
 * @author Eternal
 * @since 2018-08-26
 */
@RestController
@RequestMapping("/userRole")
public class UserRoleController {

    @Autowired
    private UserRoleService userRoleService;

    @GetMapping("/queryRole")
    @RequiresPermissions("system_permission_role_queryRoleInfoById")
    public ResultVo<RoleInfo> queryRole(String userId){
        List<RoleInfo> roleByUserId = userRoleService.getRoleByUserId(userId);
        return new ResultVo(roleByUserId);
    }

}

